import java.util.Scanner;

public class test1{
	public static void main(String [] args){

		int[] days={31,28,31,30,31,30,31,31,30,31,30,31};
		int year;
		int mon;
		int day;

		do{
			System.out.println("Please input date (example: 2020 08 09) :");
			Scanner sc = new Scanner(System.in);
			year = sc.nextInt();
			mon = sc.nextInt();
			day = sc.nextInt();

			if((0==year%4 && 0!=year%100) || 0==year%400)
			{
				days[1]=29;
			}

			if(mon< 1 || mon >12)
			{
				System.out.println("Please input right date !");
				continue;
			}

			if(day <1 || day >days[mon-1])
			{
				System.out.println("Please input right date !");
				continue;
			}

			break;
		}while(true);


		int num=0;
		for(int i=0;i<mon-1;i++)
		{
			num=num+days[i];
		}
		num=num+day;

		System.out.println("The day you input is the "+num+"th day in the year .");
	}
}